<template>
    <div>
        <el-form :model="form" label-width="100px" ref="form1">
            <el-form-item prop="realName" label="任务名称">
                <el-input v-model="form.realName" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="出生日期">
                <el-input v-model="form.birthday" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="性别">
                <el-input v-model="form.gender" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="手机号">
                <el-input v-model="form.phone" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="身份证">
                <el-input v-model="form.cardno" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="队内身份">
                <el-input v-model="form.teamRole" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="组内职务">
                <!-- 添加输入元素 -->
            </el-form-item>
            <el-table :data="zhiw">

                <el-table-column prop="name" label="组名" width="180"></el-table-column>

                <el-table-column prop="orgRole" label="角色" width="180"></el-table-column>

                <el-table-column prop="type" label="类型" width="180"></el-table-column>
            </el-table>

            <el-form-item prop="realName" label="公司单位">
                <el-input v-model="form.company" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="单位职务">
                <el-input v-model="form.job" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="政治面貌">
                <el-input v-model="form.politics" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="学历">
                <el-input v-model="form.education" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="是否服兵役">
                <el-input v-model="form.militaryService" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="是否为MB">
                <el-input v-model="form.isManager" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="家庭地址">
                <el-input v-model="form.address" disabled></el-input> <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item label="救援证书">
                <!-- 图 -->

                <el-image :src="form.rescueCert"></el-image>
                <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="无犯罪记录">
                <!-- 图 -->


                <el-image :src="form.noCrimeRecord"></el-image>
                <!-- 添加输入元素 -->
            </el-form-item>
            <el-form-item prop="realName" label="注册时间">
                <!-- 计时器 -->

                <el-input v-model="form.registerDate" disabled></el-input>

            </el-form-item>

            <el-form-item label="任务时间" clearable>
                <el-date-picker v-model="value1" type="daterange" range-separator="至" start-placeholder="开始日期"
                value-format="yyyy-MM-dda "
                    end-placeholder="结束日期">
                </el-date-picker>
            </el-form-item>

            <el-table :data="nalaiba">

                <el-table-column type="index" label="id" width="180"></el-table-column>

                <el-table-column prop="taskName" label="任务名称" width="180"></el-table-column>

                <el-table-column prop="taskDistrict" label="地点" width="180"></el-table-column>
                <el-table-column prop="finalDuration" label="时长" width="180"></el-table-column>
            </el-table>


<div>总时长:{{ xiaoshi }}</div>

        </el-form>
    </div>
</template>
<script>
import { naxiangqing, gerenshichang } from '@/api';
export default {
    props: ['ming'],

    data() {
        return {
            value1:'',
            form: {

            },
            zhengming: {},
            xx: '',
            zhiw: [],
            cc: '',
            formda: {
                endDate:'',
                startDate:'',
                realName:''
            },
            nalaiba: []

            // ming:'',
        }
    },
    methods: {

        huoming() {
            this.xx = this.ming
            this.zhengming.realName = this.xx;
            console.log(this.zhengming, 12345);

            // {
            //     realName:"cc"
            // }
            naxiangqing(this.zhengming).then(res => {
                console.log(res.data, 9174);
                this.form = res.data
                console.log(this.form.realName);
                this.zhiw = res.data.groups
                console.log(res.data.groups);
                console.log(res.data.photo, 9174);
                this.cc = res.data.realName
                console.log(this.cc, 5577);

                this.formda.realName = this.cc
                console.log(this.formda.realName, 88882);
          this.kankan()
            })

        },
        kankan(){
            if (this.formda) {
                    console.log(1);
                    console.log(this.formda.realName, 886644);

                    gerenshichang(this.formda).then(res => {
                        console.log(res, 918725);
                        this.nalaiba = res.data
                    })
                }

        }



    },
    mounted() {
        this.huoming()
        console.log(this.zhengming, 666);


    },
    computed: {
        xiaoshi() {
            return this.nalaiba.reduce((pre, next) => pre + next.finalDuration, 0).toFixed(1)
        }
    },
    watch:{
        value1:{
            handler(){
                if(Array.isArray(this.value1)){
this.formda.startDate=this.value1[0],
this.formda.endDate=this.value1[1],
this.kankan()
                }
            }
        }
    }
}
</script>